package sosopkpk;

import java.util.Scanner;

public class J08NonArray {
	// 학생 3명분의 성적 처리
	// 배열을 사용하지 않고 구현
	public static void main(String[] args) {
		// 변수 선언
		String name1, name2, name3; 
		int kor1, kor2, kor3;
		int eng1, eng2, eng3;
		int mat1, mat2, mat3;
		int tot1, tot2, tot3;
		double avg1, avg2, avg3;
		char grd1, grd2, grd3;
		Scanner sc = null;
		String result = "";

		// 입력
		sc = new Scanner(System.in);
		System.out.println("첫번째 학생성적을 입력합니다");
		System.out.println("이름은?");
		name1 = sc.next();
		System.out.println("점수는? (국어, 영어, 수학 순으로)");
		kor1 = sc.nextInt();
		eng1 = sc.nextInt();
		mat1 = sc.nextInt();
		System.out.println("두번째 학생성적을 입력합니다");
		System.out.println("이름은?");
		name2 = sc.next();
		System.out.println("점수는? (국어, 영어, 수학 순으로)");
		kor2 = sc.nextInt();
		eng2 = sc.nextInt();
		mat2 = sc.nextInt();
		System.out.println("세번째 학생성적을 입력합니다");
		System.out.println("이름은?");
		name3 = sc.next();
		System.out.println("점수는? (국어, 영어, 수학 순으로)");
		kor3 = sc.nextInt();
		eng3 = sc.nextInt();
		mat3 = sc.nextInt();

		// 성적 처리
		// 첫번째 학생
		tot1 = kor1 + eng1 + mat1;
		avg1 = (double) tot1 / 3;
		switch ((int) avg1 / 10) {
		case 10:
		case 9:
			grd1 = '수';
			break;
		case 8:
			grd1 = '우';
			break;
		case 7:
			grd1 = '미';
			break;
		case 6:
			grd1 = '양';
			break;
		default:
			grd1 = '가';
		}
		// 두번째 학생
		tot2 = kor2 + eng2 + mat2;
		avg2 = (double) tot2 / 3;
		switch ((int) avg2 / 10) {
		case 10:
		case 9:
			grd2 = '수';
			break;
		case 8:
			grd2 = '우';
			break;
		case 7:
			grd2 = '미';
			break;
		case 6:
			grd2 = '양';
			break;
		default:
			grd2 = '가';
		}
		// 세번째 학생
		tot3 = kor3 + eng3 + mat3;
		avg3 = (double) tot3 / 3;
		switch ((int) avg3 / 10) {
		case 10:
		case 9:
			grd3 = '수';
			break;
		case 8:
			grd3 = '우';
			break;
		case 7:
			grd3 = '미';
			break;
		case 6:
			grd3 = '양';
			break;
		default:
			grd3 = '가';
		}

		// 결과 출력
		result += name1 + "\t" + kor1 + "\t" + eng1 + "\t" + mat1 + "\t" + tot1
				+ "\t" + avg1 + "\t" + grd1 + "\n";
		result += name2 + "\t" + kor2 + "\t" + eng2 + "\t" + mat2 + "\t" + tot2
				+ "\t" + avg2 + "\t" + grd2 + "\n";
		result += name3 + "\t" + kor3 + "\t" + eng3 + "\t" + mat3 + "\t" + tot3
				+ "\t" + avg3 + "\t" + grd3 + "\n";
		System.out.println(result);

		sc.close();

	} // main
} // class
